package com.ruoyi.feedingAreaManagement.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.feedingAreaManagement.domain.EthicalReviewManagement;
import com.ruoyi.feedingAreaManagement.service.IEthicalReviewManagementService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 伦理审查管理Controller
 * 
 * @author wj
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/feedingAreaManagement/ethicalReviewManagement")
public class EthicalReviewManagementController extends BaseController
{
    @Autowired
    private IEthicalReviewManagementService ethicalReviewManagementService;

    /**
     * 查询伦理审查管理列表
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:list')")
    @GetMapping("/list")
    public TableDataInfo list(EthicalReviewManagement ethicalReviewManagement)
    {
        startPage();
        List<EthicalReviewManagement> list = ethicalReviewManagementService.selectEthicalReviewManagementList(ethicalReviewManagement);
        return getDataTable(list);
    }

    /**
     * 导出伦理审查管理列表
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:export')")
    @Log(title = "伦理审查管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EthicalReviewManagement ethicalReviewManagement)
    {
        List<EthicalReviewManagement> list = ethicalReviewManagementService.selectEthicalReviewManagementList(ethicalReviewManagement);
        ExcelUtil<EthicalReviewManagement> util = new ExcelUtil<EthicalReviewManagement>(EthicalReviewManagement.class);
        util.exportExcel(response, list, "伦理审查管理数据");
    }

    /**
     * 获取伦理审查管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:query')")
    @GetMapping(value = "/{ethicalReviewManagementId}")
    public AjaxResult getInfo(@PathVariable("ethicalReviewManagementId") Long ethicalReviewManagementId)
    {
        return success(ethicalReviewManagementService.selectEthicalReviewManagementByEthicalReviewManagementId(ethicalReviewManagementId));
    }

    /**
     * 新增伦理审查管理
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:add')")
    @Log(title = "伦理审查管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EthicalReviewManagement ethicalReviewManagement)
    {
        return toAjax(ethicalReviewManagementService.insertEthicalReviewManagement(ethicalReviewManagement));
    }

    /**
     * 修改伦理审查管理
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:edit')")
    @Log(title = "伦理审查管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EthicalReviewManagement ethicalReviewManagement)
    {
        return toAjax(ethicalReviewManagementService.updateEthicalReviewManagement(ethicalReviewManagement));
    }

    /**
     * 删除伦理审查管理
     */
    @PreAuthorize("@ss.hasPermi('feedingAreaManagement:ethicalReviewManagement:remove')")
    @Log(title = "伦理审查管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ethicalReviewManagementIds}")
    public AjaxResult remove(@PathVariable Long[] ethicalReviewManagementIds)
    {
        return toAjax(ethicalReviewManagementService.deleteEthicalReviewManagementByEthicalReviewManagementIds(ethicalReviewManagementIds));
    }
}
